/**
 * @Author Stringzhua
 * @Date 2024/3/7 19:21
 * description:
 */
public class OuterClass {//外部类
    private String outerName;//成员变量

    public void display() {//成员方法
        System.out.println("OuterClass display");
        System.out.println(outerName);
    }

    //内部类
    public class InnerClass {
        private String innerName;

        public void display() {
            System.out.println("InnerClass diaplay");
            System.out.println(innerName);
        }

        public InnerClass() {
            innerName = "inner Class";
        }
    }

    public static void main(String[] args) {
        OuterClass outerClass = new OuterClass();
        outerClass.display();
        OuterClass.InnerClass innerClass = outerClass.new InnerClass();//此时创建的是内部类,无法被创建
        //OuterClass.InnerClass表明 innerClass是outerClass的内部类
        innerClass.display();
    }
}

class A{//外部其他类

}